package com.automation.ljf.repository.impl.mapper;

import com.automation.ljf.domain.po.CaseReportPO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 操作mf_case_report表
 *
 * @author lijiefeng
 * @since 2021/8/27
 */
@Mapper
public interface CaseReportMapper {

    /**
     * 插入用例执行结果
     * @param caseReportPO  用例镜像PO
     * @return  Integer
     */
    @Insert("insert into mf_case_report" +
            "(id, case_id, report_id, case_url, case_name, case_detail, case_result, adm_user_id, create_time, update_time) " +
            "values(#{cr.id}, #{cr.caseId}, #{cr.reportId}, #{cr.caseUrl}, #{cr.caseName}, #{cr.caseDetail}, #{cr.caseResult}, " +
            "#{cr.admUserId}, #{cr.createTime}, #{cr.updateTime})")
    Integer insertCaseReport(@Param("cr") CaseReportPO caseReportPO);


    @Select("select id, case_id, report_id, case_url, case_name, case_detail, case_result, adm_user_id, create_time, update_time " +
            "from mf_case_report " +
            "where adm_user_id = #{uId} and is_delete = false")
    List<CaseReportPO> selectCaseReportByUId(@Param("uId") String admUserId);
}
